namespace Example
{
    using System;
    using System.IO;
    using System.Web;
    using System.Web.Mvc;
    using System.Web.Routing;
    using Example.Models;
    using Moq;
    using SimpleWebServices;
    using SimpleWebServices.Data;
    using SimpleWebServices.Web;
    using Xunit;

    public sealed class GlobalAsaxFacts
    {
        [Fact]
        public void typedef()
        {
            Assert.True(new ObjectExpectations<MvcApplication>()
                .DerivesFrom<HttpApplication>()
                .IsConcreteClass()
                .IsUnsealed()
                .HasDefaultConstructor()
                .IsNotDecorated()
                .Result);
        }

        [Fact]
        public void ctor()
        {
            Assert.NotNull(new MvcApplication());
        }

        [Fact]
        public void op_Application_Start()
        {
            FakeRepository.Clear();

            try
            {
                FakeRepository.Register<Distance>();

                new MvcApplication().Application_Start();

                Assert.NotNull(ModelBinders.Binders[typeof(ContactForm)]);

                Assert.NotEqual<int>(0, RouteTable.Routes.Count);
            }
            finally
            {
                FakeRepository.Reset();
            }
        }
    }
}